{extend name='admin@public/content'}


{block name="button"}
<!--{if auth("$classuri/add")}-->
<button data-modal='{:url("$classuri/add")}' data-title="添加机器" class='layui-btn layui-btn-sm layui-btn-primary'>添加机器</button>
<!--{/if}-->

{/block}


{block name="content"}

<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" id="myform" onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
            <label class="layui-form-label">所属地区</label>
            <div class="layui-input-inline">
                <select name="area" id="area" lay-verify="required" class="layui-input" style="display: block;">
                    <option value="">查询地区</option>
                    {foreach $areas as $area }
                    <option value="{$area.id}" {if condition="$Think.get.area == $area.id"} selected="selected"{/if} >{$area.area_name}</option>
                    {/foreach}
                </select>
            </div>
        </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">设备号</label>
        <div class="layui-input-inline">
            <input name="code" id="code" value="{$Think.get.code|default=''}" placeholder="请输入设备号" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>
    
</form>

<!--{empty name='list'}-->
<p class="help-block text-center well">没 有 记 录 哦！</p>
<!--{else}-->
<input type="hidden" value="resort" name="action">
<table class="layui-table" lay-skin="line">
    <thead>
    <tr>
        <th class='text-left nowrap'>机器编码</th>
        <th class='text-left nowrap'>IMEI</th>
        <th class='text-left nowrap'>品牌型号</th>
        <th class='text-left nowrap'>机器地区</th>
        <th class='text-left nowrap'>机器具体地址</th>
        <th class='text-left nowrap'>连线状态</th>
        <th class='text-left nowrap'>运行状态</th>
        <th class='text-left nowrap'>剩余时间</th>
        <th></th>
        	
    </tr>
    </thead>
    <tbody>
    <!--{foreach $list as $key=>$vo}-->
    <tr>
        <td class='text-left nowrap'>
            {$vo.machine_no}
        </td>
        <td class='text-left nowrap'>
            {$vo.imei}
        </td>
        <td class='text-left nowrap'>
            {$vo.supplier} - {$vo.brand} - {$vo.name}
        </td>

        <td class='text-left nowrap'>
            {$vo.area_name}
        </td>
        <td class='text-left nowrap'>
            {$vo.dormitory_num}
        </td>
        
        <td class='text-left nowrap'>
            
            {if 2== $vo.machine_type_id}
                {if (time() - 120) >= $vo.last_heart}
                    <span style="color: red;" >离线</span>
                {else}
                    <span  style="color: #5eb95e;" >在线</span>
                {/if}

                <span class="text-explode">|</span>
                <a data-title="状态日志记录最近300条" data-modal='{:url("$classuri/log")}?code={$vo.machine_no}&imei={$vo.imei}'>日志</a>
            {/if}
            
        </td>
        <td class='text-left nowrap'>
            {if 2== $vo.machine_type_id}
                <span >
                        <?php echo array_search($vo['status'],$sme_type_array); ?>
                </span>

            {/if}
        </td>

        <td class='text-left nowrap'>
            {if 2== $vo.machine_type_id}
                <span >{$vo.surplus_time}</span>
            {/if}
        </td>



        <td class='text-left nowrap'>

                

            {if auth("$classuri/edit")}
            <span class="text-explode">|</span>
            <a data-title="编辑机器" data-modal='{:url("$classuri/edit")}?id={$vo.id}'>编辑</a>
            {/if}

            {if auth("$classuri/del")}
            <span class="text-explode">|</span>
            <a data-title="删除机器" data-update="{$vo.id}"   data-field='delete' data-action='{:url("$classuri/del")}?id={$vo.id}'>删除</a>
            {/if}


        </td>
    </tr>
    <!--{/foreach}-->
    </tbody>
</table>
{if isset($page)}<p>{$page|raw}</p>{/if}
<!--{/empty}-->


{/block}